#include "Engine.h"
#include "StateMachine.h"
#include "MainMenu.h"
#include "Editor.h"

int main(int argc, char* args[])
{
    bool quit = false;

    Artist artist(quit);
    StateMachine stateMachine;

    Editor editor(&artist, &stateMachine);
    Engine game(&artist, &stateMachine);
    MainMenu mainMenu(&artist, &stateMachine);

    while(!quit)
    {
        switch(stateMachine.getState())
        {
            case TITLE:     stateMachine.setState(MAIN_MENU); break;

            case MAIN_MENU: mainMenu.run(); break;

            case SAVE:      //save stuff
                            stateMachine.setState(CONTINUE); break;

            case LOAD_GAME: //load menu
                            stateMachine.setState(NEW_GAME);
                            break;

            case NEW_GAME:  game.newGame();

            case CONTINUE:  game.run();
                            mainMenu.setState(IN_GAME);
                            break;

            case EDITOR:    editor.run();
                            mainMenu.setState(EDITOR);
                            break;

            case QUIT:      quit = true; break;

            default: stateMachine.setState(MAIN_MENU); break;
        }
    }

}
